package com.airagg.portal.project.controller;

import com.airagg.module.entity.Module;
import com.airagg.module.provider.ModuleService;
import com.airagg.project.entity.Project;
import com.airagg.project.provider.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2017/3/21.
 */
@Controller
@RequestMapping("/project")
public class ProjectController {

    @Autowired
    private ProjectService projectService;
    @Autowired
    private ModuleService moduleService;


    @RequestMapping("/projects")
    @ResponseBody
    public List<Project> projects() {
        List<Project> projects = projectService.findAllProject();
        return projects;
    }

    @RequestMapping("/detail")
    @ResponseBody
    public List<Module> getProjectDetail(String id) {
        List<Module> modules = moduleService.findAllModules(id);
        return modules;
    }

}
